{% extends 'base.html' %}
{% load i18n %}
{% load static %}

{% block title %}{% translate '同步宿主机中的虚拟机信息' %}{% endblock %}

{% block head %}{% endblock %}

{% block boby %}
    <div class="container-fluid col-12">
        <div class="card">
            <div class="card-header">
                <span class="card-title">{% translate '同步宿主机中的虚拟机信息' %}</span>
                <span><a class="btn btn-outline-primary float-right" href="{% url 'vms:vms-list' %}">
                    {% translate '虚拟机列表' %}
                </a></span>
            </div>
            <div class="card-body align-content-center">
                <form class="form-horizontal" method="post" action="{% url 'vms:vm-sync' %}">
                    <div class="form-group row">
                        <label for="id-host-ip"
                               class="offset-sm-1 col-sm-2 text-right col-form-label">{% translate '宿主机' %}</label>
                        <div class="col-sm-7">
                            <select class="form-control" name="hostip">
                                {% for host in hosts %}
                                    <option value="{{ host.id }}">{{ host.ipv4 }}</option>
                                {% endfor %}
                            </select>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="id-vm-uuid"
                               class="offset-sm-1 col-sm-2 text-right col-form-label">{% translate '虚拟机uuid' %}</label>
                        <div class="col-sm-7">
                            <input name="vm-uuid" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="id-mac-ip"
                               class="offset-sm-1 col-sm-2 text-right col-form-label">{% translate '虚拟机IP' %}</label>
                        <div class="col-sm-7">
                            <input name="vm-mac-ip" type="text" class="form-control" placeholder="MAC和IP任填写一个, MAC和IP都填写会校验">
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="id-mac"
                               class="offset-sm-1 col-sm-2 text-right col-form-label">{% translate '虚拟机MAC' %}</label>
                        <div class="col-sm-7">
                            <input name="vm-mac" type="text" class="form-control" placeholder="MAC和IP任填写一个, MAC和IP都填写会校验">
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="id-vm-uuid"
                               class="offset-sm-1 col-sm-2 text-right col-form-label">{% translate '镜像' %}</label>
                        <div class="col-sm-7">
                            <select class="form-control" name="image-id">
                                {% for image in images %}
                                    <option value="{{ image.id }}">{{ image.name }}</option>
                                {% endfor %}
                            </select>
                        </div>
                    </div>
                    <div class="form-group row">
                        <div class="offset-sm-1 col-sm-2">
                            <button type="submit" class="btn btn-primary float-right"
                                    id="host-sync-vm">{% translate '同步' %}</button>
                        </div>
                    </div>
                </form>
            </div>
            <div class="panel-footer">

            </div>
        </div>
    </div>
{% endblock %}

{% block script %}
    <script type="text/javascript">
        {% if err_msg %}
            alert('{{ err_msg }}')

        {% endif %}
    </script>
{% endblock %}




